<template>
    <view class="coreshop-bg-white">
        <u-swiper :list="swiperItems" :height="swiperHeight" :interval="swiperDuration" keyName="image" @click="onClicked" indicator indicatorMode="line" circular radius="0"></u-swiper>
    </view>
</template>

<script>
    export default {
        name: "coreshopImgSlide",
        props: {
            coreshopData: {
                type: Object,
                required: true,
            }
        },
        data() {
            return {
                swiperItems: [],
                swiperHeight: 150,
                swiperDuration: 2500,
            };
        },
        computed: {
            count() {
                return (this.coreshopData.list.length > 0)
            }
        },
        created() {
            var data = this.coreshopData.list;
            for (var i = 0; i < data.length; i++) {
                let moder = {
                    image: data[i].image,
                    opentype: 'click',
                    url: '',
                    title: data[i].linkType,
                    linkType: data[i].linkType,
                    linkValue: data[i].linkValue,
                }
                this.swiperItems.push(moder);
            }
            this.swiperHeight = this.coreshopData.height;
            this.swiperDuration = this.coreshopData.duration;
        },
        methods: {
            onClicked: function (e) {
                this.showSliderInfo(this.swiperItems[e].linkType, this.swiperItems[e].linkValue);
            },
        }
    }
</script>
